package com.trg.flex.frm.validation
{
	import mx.validators.Validator;
	import mx.validators.ValidationResult;

	public class EqualValidator extends Validator
	{
		public function EqualValidator()
		{
			super();
		}
		
		public var equalTo:Object = null;
		
		public var notEqualError:String = null;
		
		override protected function doValidation(value:Object):Array
	    {
			var results:Array = super.doValidation(value);
			
			if (results.length == 0 && equalTo != null && value != equalTo) {
				results.push(new ValidationResult(
					true, null, "notEqual",
					(notEqualError != null) ? notEqualError : "The value of this field must be " + equalTo.toString()
							/*resourceManager.getString("myResources","VALIDATOR.NOT_EQUAL_ERROR")*/));
			}
			
			return results;
	    }
		
	}
}